package com.aco.party.web.validator.system;

import com.aco.party.web.command.system.EditMetaCommand;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
* Created by flying on 3/10/2016 0010.
*/
public class EditMetaValidator implements Validator {
@Override
public boolean supports(Class<?> aClass) {
return EditMetaCommand.class.isAssignableFrom(aClass);
}

@Override
public void validate(Object o, Errors errors) {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.name.empty", "名字不能为空");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "type", "error.type.empty", "类别不能为空");
}
}
